<template>
  <div class="zh-redian">
    <div class="zh-redian-search">
      <div class="search-top">
        <i class="iconfont icon-search"></i>
        <span>这是一个搜索的东西</span>
      </div>
    </div>
    <div class="zh-redian-list">
      <div class="zh-list-top">
        <i class="iconfont icon-hot"></i>
        <span>实时热榜</span>
      </div>
      <div class="zh-list-sort">
        <div class="zh-list-box" v-for="item in hotList" :key="item.sort" @click="contentRouterDetal(item)">
         <span class="zh-list-title">{{ item.title }}</span>
          <i :class="[ 'iconfont','ic-color', item.type === 'office' ? 'icon-icon-guanfang' : item.type === 'new' ? 'icon-xin1' : item.type === 'hot' ? 'icon-re' : '']"></i>
        </div>
        <!-- <div class="line"></div> -->
      </div>
    </div>
    <div class="zh-redian-content">
      <!-- <div class="zh-content-tabs"> -->
        <!-- <div class="tabs-item" v-for="item in tabsList" :key="item.type" @click="tabsClick(item)" :class="{ 'is-active': item.isActive }">{{ item.type }}</div> -->
        <pl-tabs :tabs="tabsList" active="1" ></pl-tabs>
      <!-- </div> -->
      <div class="zh-content-card">
        <div class="zh-card-box" v-for="item in 5" :key="item">
          <div class="zh-card-title">
            <div class="photo" :style="{'background-image': 'url(' + photo + ')'}"></div>
            <div class="describe">
              <div class="name">
                梓豪小哥哥
                <i class="iconfont icon-svip"></i>
                <i class="iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu_d"></i>
              </div>
              <div class="desc">IT科技</div>
            </div>
            <div class="care">
              <div class="care-btn">关注 +</div>
            </div>
          </div>
          <div class="zh-card-content" @click="contentRouterDetal">
            5月22日，突如其来的恶劣天气让五名越野赛选手汇集一起。此时，甘肃景泰县常生村牧羊人朱克铭正在窑洞避雨。听到求助声后，他循声走出窑洞，看到一群选手中有一位已经在抽搐。朱克铭把大伙带到窑洞，又生起了几堆火。随后他跑到有信号的地方，拨打了景区的救援热线。
          </div>
          <div class="zh-card-footer">
            <div class="btn">
              <i class="iconfont icon-zanpress" style="color: '#e20500'"></i>
              <i class="iconfont icon-pengyouquan" style="color: '#f4c900'" ></i>
              <i class="iconfont icon-forward-null" style="color:'#12daff'"></i>
            </div>
            <div class="date">
              日期: 2021-05-21
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      hotList: [
        { title: '外媒集体为袁隆平教授默哀', type: 'office', sort: 1 },
        { title: '明星社死时有多尴尬的', type: 'default', sort: 2 },
        { title: '和地心引力有关系的什么东西', type: 'default', sort: 3 },
        { title: '赵总集团分崩离析资产何去何从', type: 'hot', sort: 4 },
        { title: '郭经历连夜赶回郑州竟只为相亲', type: 'new', sort: 5 },
        { title: '刘彦祖奔赴远洋只为女朋友', type: 'default', sort: 6 },
        { title: '胖仔为求工作不惜深受终生', type: 'default', sort: 7 },
        { title: 'Messi为救一球身体不堪重负', type: 'default', sort: 8 },
        { title: '姚明刘翔同台合作上演大戏', type: 'office', sort: 9 },
        { title: '这是一个段子无聊的段子', type: 'hot', sort: 10 }
      ],
      tabsList: [
        { type: '热门', isActive: false, id: 1 },
        { type: '同城', isActive: false, id: 2 },
        { type: '科技', isActive: false, id: 3 },
        { type: 'IT', isActive: false, id: 4 },
        { type: '电影', isActive: false, id: 5 }
      ],
      photo: localStorage.getItem('txImage') || require('@/assets/image/photo.jpg')
    }
  },
  methods: {
    tabsClick (e) {
      this.tabsList.forEach(item => { item.isActive = false })
      this.tabsList.filter(item => item.id === e.id)[0].isActive = true
    },
    // 查看文章详情
    contentRouterDetal () {
      this.$router.push({
        name: 'article'
      })
    }
  }
}
</script>

<style lang="less" scoped>
  .zh-redian {
    padding-bottom: 70px;
    user-select: none;
    .zh-redian-search {
      padding: 10px 10px 0px;
      .search-top {
        width: 100%;
        padding-left: 20px;
        height: 35px;
        line-height: 35px;
        border-radius: 15px;
        background: #eee;
        box-sizing: border-box;
        font-size: 14px;
        display: flex;
        align-items: center;
        .icon-search {
          margin-right: 5px;
        }
      }
    }
    .zh-redian-list {
      // padding-left: 15px;
      padding: 0px 15px;
      margin-top: 5px;
      .zh-list-top {
        color: #e20500;
        height: 20px;
        font-size: 14px;
        display: flex;
        align-items: center;
        margin-top: 10px;
        .icon-hot {
          margin-right: 5px;
        }
      }
      .zh-list-sort {
        height: 170px;
        margin-top: 10px;
        background: #fff;
        border-radius: 5px;
        box-shadow: 0px 0px 8px 0px rgba(150,178,191,0.2);
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 5px 0px;
        box-sizing: border-box;
        position: relative;
        .zh-list-box {
          width: 50%;
          padding-left: 10px;
          padding-right: 10px;
          height: 30px;
          line-height: 30px;
          display: flex;
          align-items: center;
          box-sizing: border-box;
          .zh-list-title {
            &:hover {
              color: #e20500;
            }
            font-size: 12px;
            // max-width: 160px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12px;
          }
          .ic-color {
            color: #e20500;
            margin-left: 3px;
            font-size: 14px;
          }
          .icon-hot {
            color: #f4c900;
          }
          .icon-xin1 {
            color: #ff3bd1;
          }
          .icon-icon-guanfang {
            color: #12daff;
          }
        }
        .line {
          position: absolute;
          left: 50%;
          transform: translateX(-50%);
          width: 1px;
          height: 85%;
          background: #eee;
        }
      }
    }
    .zh-redian-content {
      margin-top: 15px;
      .zh-content-tabs {
        margin-top: 20px;
        display: flex;
        align-items: center;
        justify-content: space-around;
        background: #fff;
        .tabs-item {
          height: 36px;
          line-height: 36px;
          font-size: 14px;
          padding: 0px 20px;
        }
        .is-active {
          color: #e20500;
        }
      }
      .zh-content-card {
        margin-top: 10px;
        padding: 0px 10px 10px 10px;
        .zh-card-box {
          height: 180px;
          padding: 10px;
          background: #fff;
          border-radius: 5px;
          margin-bottom: 10px;
          box-sizing: border-box;
          position: relative;
          .zh-card-title {
            display: flex;
            align-items: center;
            position: relative;
            .photo {
              width: 30px;
              height: 30px;
              border-radius: 100%;
              background-position: center !important;
              background-size: cover !important;
            }
            .describe {
              font-size: 10px;
              margin-left: 10px;
              .name {
                color: #e20500;
                display: flex;
                align-items: center;
                .iconfont {
                  margin-left: 3px;
                }
              }
              .desc {
                color: #c9ced7;
              }
            }
            .care {
              align-self: flex-start;
              position: absolute;
              right: 0px;
              .care-btn {
                height: 20px;
                line-height: 20px;
                border-radius: 4px;
                font-size: 12px;
                color: #f4c900;
                background: #e21016;
                padding: 0px 12px;
              }
            }
          }
          .zh-card-content {
            margin-top: 10px;
            padding-left: 5px;
            font-size: 12px;
            &:hover {
              color: #e20500;
            }
          }
          .zh-card-footer {
            position: absolute;
            bottom: 10px;
            left: 15px;
            width: 93%;
            height: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
            .btn {
              .iconfont {
                font-size: 12px;
                margin-right: 5px;
                color: #e20500;
              }
            }
          }
        }
      }
    }
  }
</style>
